package main

import "fmt"
/*
	File: triggers.go
	Author: luckyFang
	Date: 2022-04-16
	Desc： 这里用来注册触发器
*/



// 注册触发对象
func registerTriggers() *Subject {
	// 观察者对象
	subject := NewSubject()
	// 添加任务
	h := 18
	min := 31
	subject.add(NewScheduleTask("触发器1",TTime{
		Year: 2021,
		Mon:  4,
		Day:  16,
		Hour: h,
		Min:  min,
		Sec:  0,
	}, func() {
		fmt.Println("trigger 1")
	}))
	subject.add(NewScheduleTask("触发器2",TTime{
		Year: 2021,
		Mon:  4,
		Day:  16,
		Hour: h,
		Min:  min,
		Sec:  20,
	}, func() {
		fmt.Println("trigger 2")
	}))
	subject.add(NewScheduleTask("触发器3",TTime{
		Year: 2021,
		Mon:  4,
		Day:  16,
		Hour: h,
		Min:  min,
		Sec:  40,
	}, func() {
		fmt.Println("trigger 3")
	}))
	return &subject
}
